package cn.itsource.basic.listener;

import cn.itsource.sys.service.IPermissionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

@WebListener//申明自定义的web监听器，被容器注册和使用
@Slf4j
public class PermissionScanInitListener implements ServletContextListener {

    @Autowired
    private IPermissionService permissionService;
    
    //spring容器初始化结束之后被调用
    @Override
    public void contextInitialized(ServletContextEvent servletContextEvent) {
        permissionService.scanPermission();
    }
 
}